import re
import os

def subtitle(name):
    l = []
    dir_path1 = r'C:\Users\zhengyang\learning\python\src\data'
    dir_path2 = r'C:\Users\zhengyang\Downloads'

    with open(os.path.join(dir_path1, name+'.txt'), 'r', encoding='utf--8') as file_before_process:
        for line in file_before_process:
            if not(line == '\n' or re.match('.*-->.*', line) or re.match('[0-9]*\n', line)):
                l.append(line)

    word = ''.join(l)
    name+='_end'
    with open(os.path.join(dir_path2, name+'.md'), 'w', encoding='utf--8') as file_save:
        file_save.write(word)

print("请把文件放入python\\src\\data目录下\n不需要后缀名")
print("处理后的文件会保存在Downloads目录下")
name = input("请输入文件名：")
subtitle(name)